essentialsdocsfandomcom-20200214-history
Berry planting
This page describes how berry plants work, along with accessories like mulch and watering cans. Berry plant patches Berries can only be planted in special patches in the overworld. In Essentials, each patch is an event set up in a particular way. Every berry plant patch event must have a name of "BerryPlant"; this allows the event's graphic to be automatically updated depending on which berry is planted and its state of growth. An empty berry plant patch will simply be an event with no graphic, set to "Stop Animation" and triggered by the action button. There is a single command on a single page, which is: @>Script: pbBerryPlant Some berry plant patches can start off containing a fully-grown berry plant. These can remain there forever until they are picked. These have two pages, the second of which is the same as above but it also has the condition of Self Switch A being on. The first page has a graphic of the berry plant, set to "Stop Animation" and "Direction Fix" (to avoid it changing its appearance when interacted with), and is triggered by the action button. On the first page is a single command, which is: @>Script: pbPickBerry(:ORANBERRY,2) The two parameters for this script are the item obtained from that plant, and the quantity. This script automatically sets the event's Self Switch A to ON when the item(s) have been picked from the plant. PBS file "berryplants.txt" Every berry plant must be defined in the PBS file "berryplants.txt". Each line in this file is one separate berry plant, and is associated with an item (the one you plant/harvest). Every line in this file follows the same format. Firstly, here are some examples: CHERIBERRY=3,15,2,5 WEPEARBERRY=2,35,2,10 OCCABERRY=18,6,1,5 The item's internal name is first, followed by an equals sign and then four values separated by commas. These values are: # The growth rate (i.e. the number of hours between growth stages) # How much moisture the soil loses per hour (Gen 4 mechanics only) # The minimum yield (how many berries can be picked if the plant is never watered) # The maximum yield (how many berries can be picked in the plant is always watered) If a berry plant is not defined in this file, it will use these default values: 3,15,2,5. Plant graphics When planted, a berry will progress through five growth stages. Each growth stage lasts the same amount of time, although how long that is depends on the berry. These stages are: # Planted # Sprouting (berries which replant themselves start off at this stage) # Growing # Flowering # Berries available for picking The graphics used for the berry plants are in the folder "Graphics/Characters". They are charsets, as they are used as the graphics for events. The first stage is the same for all berry plants, and is the file berrytreeplanted.png. Each berry plant then has its own charset for the other four stages, called berrytreeXXX.png, where "XXX" is either the internal name of the berry item or its ID number (padded to 3 digits). The four stages are in order from top to bottom. There are also three soil moisture graphics in the same folder, which are displayed underneath a berry plant (which the player has planted). These are only shown if the Gen 4 berry tree mechanics are being used (see below). They are the files berrytreedry.png, berrytreedamp.png and berrytreewet.png, and they are not charsets. Mechanics There are two sets of mechanics in Essentials for how berry plants work: those used in the Gen 3 games, and those used in the Gen 4 games. There are three settings related to berry plants, one of which determines which set of mechanics are used: # # * Whether planted berries grow according to Gen 4 mechanics (true) or Gen 3 # mechanics (false). # NEWBERRYPLANTS = true The second setting defines which animation appears over a berry plant when it grows while the player is nearby: # # * The ID of the animation played when a berry tree grows a stage while the # player is on the map (for new plant growth mechanics only). # PLANT_SPARKLE_ANIMATION_ID = 7 The third setting determines which Bag pocket contains all the plantable items. Only this pocket of the Bag is accessible when choosing an item to plant, so every plantable item must be in the same pocket (this pocket can also contain items that are not plantable, though). See the page Bag for more details. # # * The pocket number containing all berries. Is opened when choosing one to # plant, and cannot view a different pocket while doing so. # BERRYPOCKET = 5 The mechanics and calculations for berry plant growth, as well as how watering cans and mulch items work, are the same as the official games. They do not need to be described here. The berry plant event's variable contains an array of data which describes the plant. There are either 6 (Gen 3 mechanics) or 8 (Gen 4 mechanics) pieces of information in this array. While this is highly unlikely, already-planted berries will still function properly even if the setting above is changed to switch which mechanics set is used. All berries will use the mechanics set that applied at the time they were planted, as this decision depends on the size of the data array for that berry plant event (the size itself is only set once, when the berry is planted). Tips * While berries are traditionally the only things that can be planted, you could have different kinds of items to plant and grow instead/as well. For example, crystal shards which grow into larger crystals from which multiple shards can be obtained, or other kinds of vegetation such as moss or vines. ** Note that you will likely need to make changes to the code if you want to have more than one significantly different kind of plantable item (e.g. berries and crystals). For example, crystals may grow in different places to berries, may use different kinds of mulch/watering can items, and may display different messages when interacting with them. * The Gen 6 games made significant differences to the berry plant mechanics, adding new mulch items and making it possible to cross-breed two berry plants to create new kinds of berries. This isn't in Essentials, but you could add it yourself.